package com.ggh.jinjilive.common;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class ISharedPreferences {
	private static final String SYSTEM_SETTING = "ThreePigeonFlowWater";
	SharedPreferences sp = null;
	Context mContext;

	public ISharedPreferences(Context context) {
		sp = context.getSharedPreferences(SYSTEM_SETTING, Context.MODE_PRIVATE);

		this.mContext = context;
	}

	public static ISharedPreferences getInstance(Context context, String dbName) {
		ISharedPreferences isp = new ISharedPreferences(context);
		return isp;
	}

	public static ISharedPreferences getInstance(Context context) {
		ISharedPreferences isp = new ISharedPreferences(context);
		return isp;
	}

	public String getString(String str, String def) {
		return sp.getString(str, def);
	}

	public void putString(String str, String def) {
		Editor edit = sp.edit();
		edit.putString(str, def);
		edit.commit();

	}

	public int getInt(String str, int def) {
		return sp.getInt(str, def);
	}

	public void putInt(String str, int def) {
		Editor edit = sp.edit();
		edit.putInt(str, def);
		edit.commit();

	}

	public long getLong(String str, long def) {
		return sp.getLong(str, def);
	}

	public void putLong(String str, long def) {
		Editor edit = sp.edit();
		edit.putLong(str, def);
		edit.commit();

	}

	public boolean getBoolean(String str, boolean def) {
		return sp.getBoolean(str, def);
	}

	public void putBoolean(String str, boolean def) {
		Editor edit = sp.edit();
		edit.putBoolean(str, def);
		edit.commit();
	}

	public void clear() {
		Editor editor = sp.edit();
		editor.clear();
		editor.commit();
	}
	public void remove(String key) {
		Editor editor = sp.edit();
		editor.remove(key);
		editor.commit();
	}
}
